package com.wuhao.shootclient.ui.widget;

import android.view.KeyEvent;

import com.wuhao.shootclient.R;
import com.wuhao.shootclient.base.BaseDialogFragment;

/**
 * Create by hao on 2019-10-29
 */
public class LoadingDialog extends BaseDialogFragment {

    private static LoadingDialog instance;

    public static LoadingDialog getInstance() {
        if (null == instance) {
            instance = new LoadingDialog();
        }
        return instance;
    }

    @Override
    protected int getLayout() {
        return R.layout.runing_dia_log;
    }

    public void banBack() {
        //禁用返回键
        getDialog().setOnKeyListener((dialog, keyCode, event) -> keyCode == KeyEvent.KEYCODE_BACK);
    }

    public void disMissHome() {
        disMiss();
        if (getDialog() != null) {
            getDialog().setOnKeyListener((dialog, keyCode, event) -> false);
        }
    }
}
